package com.sky.myapplication.kotlin.kotlinActivity

import android.os.Bundle
import android.widget.FrameLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import com.sky.myapplication.R
import com.sky.myapplication.kotlin.kotlinFragment.OneFragment
import com.sky.myapplication.kotlin.kotlinFragment.ThreeFragment
import com.sky.myapplication.kotlin.kotlinFragment.TwoFragment

/**
 * Created by Min
 * Time 2022/10/19
 * Desc
 */
class FragmentChangeActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
//        setContentView(R.layout.activity_fragment_change)
//
//        val tv_one = findViewById<TextView>(R.id.tv_one)
//        val tv_two = findViewById<TextView>(R.id.tv_two)
//        val tv_three = findViewById<TextView>(R.id.tv_three)
//        val fl_body = findViewById<FrameLayout>(R.id.fl_body)
//
//        val oneFragment = OneFragment()
//        val twoFragment = TwoFragment()
//        val threeFragment = ThreeFragment()
//
//        var manager = supportFragmentManager
//        var transaction = manager.beginTransaction();
//
////        transaction.add(R.id.fl_body, twoFragment)
////        transaction.add(R.id.fl_body, threeFragment)
////        transaction.add(R.id.fl_body, oneFragment)
////        tansaction.commit()
//
//        transaction.replace(R.id.fl_body, oneFragment)
//        transaction.commit()
//
//        tv_one.setOnClickListener {
////            supportFragmentManager.beginTransaction().hide(twoFragment).hide(threeFragment).show(oneFragment).commit()
//            supportFragmentManager.beginTransaction().replace(R.id.fl_body, oneFragment).commit()
//        }
//        tv_two.setOnClickListener {
////            supportFragmentManager.beginTransaction().hide(oneFragment).hide(threeFragment).show(twoFragment).commit()
//            supportFragmentManager.beginTransaction().replace(R.id.fl_body, twoFragment).commit()
//        }
//        tv_three.setOnClickListener {
////            supportFragmentManager.beginTransaction().hide(twoFragment).hide(oneFragment).show(threeFragment).commit()
//            supportFragmentManager.beginTransaction().replace(R.id.fl_body, threeFragment).commit()
//        }
    }
}